package com.example.dbsample.util.spring;

public class PageUtils {
    /**
     * 用于页数计算
     * @param totalCount
     * @return
     */
    public static long getPages(long totalCount, int pageSize) {
        if(totalCount == 0L || pageSize == 0L) {
            return 0L;
        } else {
            long pages = totalCount / pageSize;
            if(totalCount % pageSize != 0L) {
                ++ pages;
            }
            return pages;
        }
    }
}
